package com.lzyjkz.quick_system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzyjkz.quick_system.entity.SysOauthInfo;
import com.lzyjkz.quick_system.entity.SysUser;
import com.lzyjkz.quick_system.mapper.SysOauthInfoMapper;
import com.lzyjkz.quick_system.service.SysOauthInfoService;
import com.lzyjkz.quick_system.service.SysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class SysOauthInfoServiceImpl extends ServiceImpl<SysOauthInfoMapper, SysOauthInfo> implements SysOauthInfoService {

    private final SysOauthInfoMapper sysOauthInfoMapper;
    private final SysUserService sysUserService;
    @Override
    public boolean existUserByIdAndPlatform(String id, String platform) {
        return sysOauthInfoMapper.existUserByIdAndPlatform(id, platform);
    }

    @Override
    public SysOauthInfo findByIdAndPlatform(String id, String platform) {
        return sysOauthInfoMapper.findByIdAndPlatform(id, platform);
    }

    @Override
    public SysUser findUserByIdAndPlatform(String id, String platform) {
        SysOauthInfo oauthInfo = findByIdAndPlatform(id, platform);
        return sysUserService.getById(oauthInfo.getUserId());
    }
}
